const tokenKey = 'hm-mobile-82'
const historyKey = 'hm-mobile-82-history'
export function setToken(tokenObj) {
  localStorage.setItem(tokenKey, JSON.stringify(tokenObj))
}

export function getToken() {
  return JSON.parse(localStorage.getItem(tokenKey)) || {}
}

export function removeToken() {
  localStorage.removeItem(tokenKey)
}

export const setHistory = (arr) => {
  localStorage.setItem(historyKey, JSON.stringify(arr))
}

export const getHistory = () => {
  return JSON.parse(localStorage.getItem(historyKey)) || []
}
